/**
 * @projectName study_java
 * @package Proxy
 * @className Proxy.Proxy
 */
package Proxy;

/**
 * Proxy
 * @description 代理类
 * @author answer_wx
 * @date 2022/6/27 10:39
 * @version 1.0
 */
public class Proxy implements IOperation {
    private RealPerson realPerson;

    public Proxy(RealPerson realPerson) {
        this.realPerson = realPerson;
    }

    public void modify(String name) {
        realPerson.setName(name);
    }

    @Override
    public void call() {
        if (realPerson == null) {
            System.out.println("真实人物不存在");
        }
        realPerson.call();
    }
}